package design_pattern.ReadWriteLock;

/**
 * @Author: 蔡翔
 * @Date: 2019/11/4 11:29
 * @Version 1.0
 */
public class ReadWorker extends Thread {
    private ShareDate shareDate;
    public ReadWorker(ShareDate shareDate){
        this.shareDate = shareDate;
    }

    @Override
    public void run() {
        try {
            while (true){
                char[] readBuf = shareDate.read();
                System.out.println(Thread.currentThread().getName()+" read "+String.valueOf(readBuf));
            }
        }catch (Exception e){

        }
    }
}